package operation;

import Dao.UserDao;
import interfac.UserOperation;
import pojo.User;
import java.util.List;
import java.util.Scanner;

public class ShowUserOperation implements UserOperation {
    @Override
    public void execute(Scanner scanner) {
        UserDao userDao = new UserDao();
        List<User> allUsers = userDao.getUsers();

        if (!allUsers.isEmpty()) {
            System.out.println("----- 员工列表 -----");
            for (User user : allUsers) {
                System.out.printf("ID: %d, 用户名: %s%n", user.getId(), user.getUsername());
            }
            System.out.println("-------------------");
        } else {
            System.out.println("没有找到任何员工记录。");
        }
    }
}